package com.sinosoft.perfect.system._.dao;

import java.sql.SQLException;
import java.util.List;

import com.sinosoft.perfect.common.system.BaseSqlSessionDaoSupport;
import com.sinosoft.perfect.system._.MapperSystem;
import com.sinosoft.perfect.system._.po.TResourceSystem;
import com.sinosoft.perfect.system._.vo.ResourceURLPower;

public class LoginUserResourceDaoImpl extends BaseSqlSessionDaoSupport implements ILoginUserResourceDao {
	
	private MapperSystem getMapperSystem(){
		return getSqlSession().getMapper(MapperSystem.class);
	}
	
	@Override
	public List<TResourceSystem> initLoginUserResourceList(String userId) throws SQLException {
		return getMapperSystem().selectResourceOfRoleSystemsByUserId(userId);
	}
	
	@Override
	public List<TResourceSystem> initLoginUserResourceListAdmin(String userId) throws SQLException {
		return getMapperSystem().selectResourceOfRoleSystemsByUserIdAdmin();
	}
	
	@Override
	public List<ResourceURLPower> getResourceURLPowers(ResourceURLPower resourceURLPower) throws SQLException {
		return getMapperSystem().selectResourceInitMainPageByUserIdAndResourceId(resourceURLPower);
	}
}
